Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parallel-tactic: fix deadlocking race between shutdown and get_task #6152

Merged

Conversation

heyitsanthony
Copy link
Contributor

Deadlock/Race is as follows:

  1. get_task() reads m_shutdown == false and enters loop body
  2. shutdown() is called; sets m_shutdown = true
  3. shutdown() calls m_cond.notify_all()
  4. get_task() finds no task in try_get_task()
  5. get_task() calls m_cond.wait(), missing the notification
  6. solve() waits forever on join()

Provided patch wraps (2) and (3) with the condition variable lock so that
step (5) cannot miss the notification.

Deadlock/Race is as follows:
  1. get_task() reads m_shutdown == false and enters loop body
  2. shutdown() is called; sets m_shutdown = true
  3. shutdown() calls m_cond.notify_all()
  4. get_task() finds no task in try_get_task()
  5. get_task() calls m_cond.wait(), missing the notification
  6. solve() waits forever on join()

Provided patch wraps (2) and (3) with the condition variable lock so that
step (5) cannot miss the notification.
@NikolajBjorner NikolajBjorner merged commit 7ae1a33 into Z3Prover:master Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants